using System;
using System.Text;

namespace RealState.BusinessObjects
{
	[Serializable()]
	public class UsersAddress
	{
		private int _UserId;

		public int UserId
		{
			get { return _UserId; }
			set { _UserId = value; }
		}

		private string _Street;

		public string Street
		{
			get { return _Street; }
			set { _Street = value; }
		}

		private Nullable<int> _DistrictId;

		public Nullable<int> DistrictId
		{
			get { return _DistrictId; }
			set { _DistrictId = value; }
		}

		private Nullable<int> _CityId;

		public Nullable<int> CityId
		{
			get { return _CityId; }
			set { _CityId = value; }
		}

		public UsersAddress()
		{ }

		public UsersAddress(int UserId,string Street,Nullable<int> DistrictId,Nullable<int> CityId)
		{
			this.UserId = UserId;
			this.Street = Street;
			this.DistrictId = DistrictId;
			this.CityId = CityId;
		}

		public override string ToString()
		{
			return "UserId = " + UserId.ToString() + ",Street = " + Street + ",DistrictId = " + DistrictId.ToString() + ",CityId = " + CityId.ToString();
		}

		public class UserIdComparer : System.Collections.Generic.IComparer<UsersAddress>
		{
			public SorterMode SorterMode;
			public UserIdComparer()
			{ }
			public UserIdComparer(SorterMode SorterMode)
			{
				this.SorterMode = SorterMode;
			}
			#region IComparer<UsersAddress> Membres
			int System.Collections.Generic.IComparer<UsersAddress>.Compare(UsersAddress x, UsersAddress y)
			{
				if (SorterMode == SorterMode.Ascending)
				{
					return y.UserId.CompareTo(x.UserId);
				}
				else
				{
					return x.UserId.CompareTo(y.UserId);
				}
			}
			#endregion
		}
		public class StreetComparer : System.Collections.Generic.IComparer<UsersAddress>
		{
			public SorterMode SorterMode;
			public StreetComparer()
			{ }
			public StreetComparer(SorterMode SorterMode)
			{
				this.SorterMode = SorterMode;
			}
			#region IComparer<UsersAddress> Membres
			int System.Collections.Generic.IComparer<UsersAddress>.Compare(UsersAddress x, UsersAddress y)
			{
				if (SorterMode == SorterMode.Ascending)
				{
					return y.Street.CompareTo(x.Street);
				}
				else
				{
					return x.Street.CompareTo(y.Street);
				}
			}
			#endregion
		}
	}
}
